//
//  BIDExchangeDetailHeaderView.m
//  HJGJCommunity
//
//  Created by mal on 2017/6/13.
//  Copyright © 2017年 mal. All rights reserved.
//

#import "BIDExchangeDetailHeaderView.h"

@implementation BIDExchangeDetailHeaderView

- (void)awakeFromNib
{
    [super awakeFromNib];
    _avatarImgView.clipsToBounds = YES;
    _avatarImgView.layer.cornerRadius = CGRectGetWidth(_avatarImgView.frame)/2;
}

- (CGRect)adjustLayoutWithDic:(NSDictionary *)dic
{
    [_avatarImgView setImage:[UIImage imageNamed:@"defaultPortrait.png"]];
    NSString *strTime = dic[@"createTime"];
    NSDate *date = [BIDGlobalMethods transToNSDateByFormatter:@"yyyy-MM-dd HH-mm-ss" fromStringDate:strTime];
    _timeLabel.text = [date timeIntervalDescription];
    _nickLabel.text = dic[@"nickName"];
    _priceLabel.text = [[NSString alloc] initWithFormat:@"￥%@", dic[@"price"]];
    _contentLabel.text = dic[@"content"];
    CGFloat height = [BIDGlobalMethods getHeightWithString:dic[@"content"] font:_contentLabel.font constraintSize:CGSizeMake(CGRectGetWidth(_contentLabel.frame), MAXFLOAT)];
    _heightForContentConstraint.constant = height;
    [self setNeedsLayout];
    [self layoutIfNeeded];
    return self.frame;
}

@end
